package com.woniuxy.order.controller;

import com.woniuxy.order.pojo.TOrder;
import com.woniuxy.order.service.TOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    private TOrderService tOrderService;

    @RequestMapping("addOrder")
    public boolean addOrder(TOrder tOrder){
        tOrder.setUserId("user202103032042012");
        tOrder.setCommodityCode("100202003032041");
        tOrder.setCount(1);
        tOrder.setMoney(100);
        return tOrderService.save(tOrder);
    }

    @RequestMapping("/query/{id}")
    public TOrder queryByid(@PathVariable("id") Integer id){
        return tOrderService.getById(id);
    }
}
